package com.bov.cas.demo.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@RestController
public class IndexController {

    @Value("${cas-server.logout-url}")
    private String logoutUrl;

    @GetMapping("/")
    public String index(){
        return "cas test";
    }

    @GetMapping("/in")
    public String ini(){
        return "bov cas in";
    }

    @GetMapping("/logout")
    public void logout(HttpServletResponse resp){
        try {
            resp.sendRedirect(logoutUrl);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
